<template>
  <el-col :span="24">
    <fc-designer ref="designer" />
  </el-col>
</template>
<script>
  export default {
    methods: {
      getOptionsJson() {
        const formDesign = {
          // 获取设计器规则
          formRule: JSON.stringify(this.$refs.designer.getRule()),
          // 获取设计器选项
          formOption: JSON.stringify(this.$refs.designer.getOption())
        }
        // 保存数据到vuex
        this.$store.dispatch('approval/setFromDesign', formDesign)
        // 获取并保存设计器规则和选项到vuex
      },
      setOptionsJson() {
        const formDesign = this.$store.getters.oaProcessTemplate
        if (formDesign) {
          if (formDesign.formRule) {
            console.log(JSON.parse(formDesign.formRule))

            this.$refs.designer.setRule(JSON.parse(formDesign.formRule))
          }
          if (formDesign.formOption) {
            console.log(JSON.parse(formDesign.formOption))
            this.$refs.designer.setOption(JSON.parse(formDesign.formOption))
          }
        }
      }
    }
  }
</script>
<style></style>
